Repository navigation
Fix selection not following items when changing sort order in folder compare - #3807
Merged
sdottaka merged 1 commit intoDec 3, 2026
Merged
Conversation
…compare The folder compare list is an owner-data list view, so the control tracks the selection, the focused row and the selection mark by row index. Sorting only reorders m_listViewItems, which left a different set of items selected after clicking a column header. Remember the selected, focused and mark items in OnColumnClick before sorting and put the state back on their new rows afterwards. Fixes WinMerge#2625
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clicking a column header in the folder compare window re-sorts the rows, but the
selection, the focused row and the Shift-selection anchor stayed on the same row
positions, so a different set of files ended up selected.
Fixes #2625
Cause: The list is an owner-data list view, so the control tracks selection and
focus by row index, and
SortColumnsAppropriately()only reordersm_listViewItems.Fix:
CDirView::OnColumnClickremembers the selected, focused and anchor itemsbefore sorting and puts the state back on their new rows afterwards. Only the
column-click path is changed.
Testing
Based on master 07d2a91, x64 Release and x64 Debug builds, Windows 11.
Time per header click with 20,000 rows: 28 ms → 29 ms with nothing selected,
29 ms → 54 ms with everything selected.